function showCredentials()
{
   setState( "credentials" );
}

function showSubmit()
{
   setState( "choices" );
}

function setState( visibleState )
{
   var states = [ "choices", "credentials" ];
   var state  = "";
   var disp   = "";
   var div    = null;
   for( var i = 0; i < states.length; i++ )
   {
      state = states[ i ];
      disp  = ( state != visibleState )? "none": "inline";
      div   = document.getElementById( state );
      if( div ) div.style.display = disp;
   }
}

function getUserInput()
{
   var form  = document.getElementById( "keepopriel_document_form" );
   var input = {};
   input.username     = localStorage[ "username" ];
   input.password     = localStorage[ "password" ];
   input.bookmark_id  = document.getElementById( "bookmarkID" ).mark.value;
   input.height       = hw.h;
   input.width        = hw.w;
   input.winID        = hw.i;
   return input;
}

function sendUserInput()
{
   var port   = chrome.extension.connect();
   var params = getUserInput();
   params.action = "store_userdata";
   port.postMessage( params );
}

